package com.ruoyi.constroller.company;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.company.domain.ComArticle;
import com.ruoyi.company.service.IComArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 文章Controller
 *
 * @author ruoyi
 * @date 2024-02-11
 */
@RestController
@RequestMapping("/company/article")
public class ComArticleController extends BaseController {
    @Autowired
    private IComArticleService comArticleService;

    /**
     * 查询文章列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ComArticle comArticle) {
        startPage();
        List<ComArticle> list = comArticleService.selectComArticleList(comArticle);
        return getDataTable(list);
    }

    /**
     * 获取文章详细信息
     */
    @PreAuthorize("@ss.hasPermi('ruoyi:article:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(comArticleService.selectComArticleById(id));
    }

}
